package com.flute.framework.index.fieldbuilder;

import org.apache.lucene.document.Field;
import org.apache.lucene.document.Field.Index;
import org.apache.lucene.document.Field.Store;

import com.flute.framework.stringprocessor.FuzzyPinyinStringProcessor;
import com.flute.tools.util.StringUtil;

public class FuzzyPinyinFieldBuilder extends AbstractLuceneFieldBuilder {

	@Override
	public Index getFieldIndex() {
		return Field.Index.ANALYZED;
	}

	@Override
	public Store getFieldStore() {
		return Field.Store.NO;
	}

	@Override
	public String process(String string) {
		if (!StringUtil.containsEnglishOrNumber(string)) {
			return new FuzzyPinyinStringProcessor().process(string);
		} else {
			return string;
		}
	}
}
